package com.itcast.demoone.kotlin

fun main() {
  // println(ifDemo(10, 20))
  // println(whenDemo(3))
  // println(whenDemo2(90))
    forDemo()
}

fun ifDemo(num1: Int, num2: Int): Int {
    /*if (num1 > num2) {
        return num1
    } else {
        return num2
    }*/

    /*return if (num1 > num2) {
        num1
    } else {
        num2
    }*/

    return if (num1 > num2) num1 else num2
}

fun whenDemo(num: Int):  String {
   var res = when (num) {
        1 -> "one"
        2 -> "two"
        3 -> "three"
        else -> "other"
    }
    return res
}

fun whenDemo2(score: Int): String = when (score) {
    in 0..60 -> "bad" // [0, 60]
    in 61 until  81 -> "good" // [60, 81)
    in 81..100 -> "excellent"
    else -> "error"
}

fun forDemo() {
  /* for (i in 1..10){
       println(i)
   }*/

   /* for (i in 1 until 10){
        println(i)
    }*/

    /*for (i in  0..100 step 2){
        println(i)
    }*/

    for (i in 100 downTo 0 step 10){
        println(i)
    }
}